{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "successful-kitchen",
   "metadata": {},
   "source": [
    "848. Shifting Letters\n",
    "\n",
    "\n",
    "https://leetcode.com/problems/shifting-letters/\n",
    "\n",
    "\n",
    "Time Out (even thorough I don't think this is a bad implementation\n",
    "\n",
    "\n",
    "```c++\n",
    "#include <vector>\n",
    "#include <algorithm>\n",
    "#include <map>\n",
    "#include <iostream>\n",
    "\n",
    "using namespace std;\n",
    "\n",
    "class Solution {\n",
    "public:\n",
    "    string shiftingLetters(string S, vector<int>& shifts) {\n",
    "        //7:37\n",
    "        const std::string alphabet{\"abcdefghijklmnopqrstuvwxyz\"};\n",
    "        map<char, int> alphabet_table;\n",
    "        for (int i=0; i<alphabet.size(); i++) {\n",
    "            alphabet_table.insert(pair<char, int>(alphabet[i], i));\n",
    "        }\n",
    "        vector<int> S_arr;\n",
    "        for ( auto c : S) {\n",
    "            S_arr.push_back(alphabet_table[c]);\n",
    "        }\n",
    "        for (int i=0; i<shifts.size(); i++) {\n",
    "            int shift = shifts[i];\n",
    "            for (int k=0; k<i+1; k++) {\n",
    "                S_arr[k] += shift;\n",
    "                S_arr[k] %= 26;\n",
    "            }\n",
    "        }\n",
    "        string s;\n",
    "        for (int i : S_arr) {\n",
    "            s.push_back(alphabet[i]);\n",
    "        }\n",
    "        return s;\n",
    "        //8:19\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "confidential-worship",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
